package com.zipkin.bean;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import zipkin.storage.mysql.MySQLStorage;

import javax.sql.DataSource;


/**
 * @ClassName: MysqlConfig
 * @Author: ZhangYue26
 * @Description: 配置数据库源，但是不配置也是可以的
 * @Date: 2021-01-18
 */
@Configuration
public class MysqlConfig {

    @Bean
    public MySQLStorage mySQLStorage(@Qualifier("dataSource") DataSource dataSource) {
        return MySQLStorage.builder().datasource(dataSource).executor(Runnable::run).build();
    }
}
